
    /*********************************************************
     *
     *  Project:      HZFlashcards
     *
     *  Class:        Fader
     *
     *  File name:    Fader.java
     *
     *  Aug 16, 2007
     *
     *********************************************************/

package com.eastmountain.junk;

//import com.eastmountain.chinese.gui.HanZiDisplayPanel;

//import com.eastmountain.chinese.gui.HanZiDisplayPanel;


public class Fader extends Thread {

    //private HanZiDisplayPanel panel;
    private float alphaValueDown = (float)1.0;
    private float alphaValueUp = (float)0.0;

    private static float ALPHA_VALUE_DELTA = (float)0.025;

    private boolean proceed;

    public Fader( /* HanZiDisplayPanel panel */ ) {

        //this.panel = panel;

        proceed = true;
        alphaValueDown = (float)1.0;

    }

    @Override
    public void run() {

        while ( proceed && alphaValueDown > (float)0.0 )  {

            System.out.println( "alpha: " + alphaValueDown );

            try {

                Thread.sleep( 100 );

            } catch ( InterruptedException e ) {

            }

            if ( alphaValueDown < Fader.ALPHA_VALUE_DELTA && alphaValueDown > (float)0.0 ) {

                alphaValueDown = (float)0.0;

            }

            //panel.fadeOut( alphaValueDown );

            alphaValueDown = alphaValueDown - Fader.ALPHA_VALUE_DELTA;

        }

        //panel.stopFaderThread();

    }


    boolean proceed() {

        return proceed;
    }


    void setProceed( boolean proceed ) {

        this.proceed = proceed;
    }



}
